﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace UI.teacher
{
    public partial class AddGrade : Form
    {
        public int ET_Id = 0;
        public AddGrade()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (ET_Id == 0)
            {
                MessageBox.Show("没有获取到任务,任务阶段不能够添加!","提示");
                this.Close();
            }
            string content = this.textBox1.Text;
            if (content.Equals(""))
            {
                MessageBox.Show("内容不能够为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            XueMeng.Model.Stage stage = new XueMeng.Model.Stage
            {
                ET_Id = this.ET_Id,
                S_Context = content,
                CreateDate = DateTime.Now,
                Enable = 0
            };
            if (new XueMeng.BLL.StageManager().Add(stage) > 0)
            {
                MessageBox.Show("任务阶段添加成功!", "提示");
                ((Grade)this.Owner).GetData();
                this.Close();
            }
            else
            {
                MessageBox.Show("任务阶段添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
